using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

/// <summary>
/// Summary description for Class1
/// </summary>
namespace SiteECSWeb
{
    public class FairsInfo : Control
    {
        public FairsInfo() :
            this(int.MinValue,string.Empty, DateTime.Today, DateTime.Today, string.Empty, string.Empty,string.Empty, string.Empty, string.Empty)
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public FairsInfo(int fairID, string name, DateTime sDate,
            DateTime eDate, string website, string countryName, string  countryNameEn, string authorityName, string imgPath)
        {
            _fairID = fairID;
            _name = name;
            _sDate = sDate;
            _eDate = eDate;
            _website = website;
            _countryName = countryName;
            _countryNameEn = countryNameEn;
            _authorityName = authorityName;
            _imgPath = imgPath;
            
        }
        private int _fairID;

        public int FairID
        {
            get { return _fairID; }
            set { _fairID = value; }
        }
	
        private string _name;
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        private DateTime _sDate;
        public DateTime SDate
        {
            get { return _sDate; }
            set { _sDate = value; }
        }


        private DateTime _eDate;
        public DateTime EDate
        {
            get { return _eDate; }
            set { _eDate = value; }
        }


        private string _website;
        public string WebSite
        {
            get { return _website; }
            set { _website = value; }
        }

        private string _countryName;

        public string CountryName
        {
            get { return _countryName; }
            set { _countryName = value; }
        }
        private string _countryNameEn;

        public string CountryNameEn
        {
            get { return _countryNameEn; }
            set { _countryNameEn = value; }
        }

        private string _authorityName;

        public string AuthorityName
        {
            get { return _authorityName; }
            set { _authorityName = value; }
        }
        

        public string DateFormat
        {
            get 
            { 
                return StringUtility.CompareAndFormatDates(_sDate,_eDate) ; 
            }
        }
        public string NavUrlDetails
        {
            get
            {
                return Helper.NavURLParamsStringVirtualName
                    (_fairID,Globals.Settings.VirtualNamesInfo.FairsDetails);
            }
        }
        public string NavUrlCountryList
        {
            get
            {
                return ResolveClientUrl (Helper.NavURLParamsStringVirtualName
                    (_countryNameEn, Globals.Settings.VirtualNamesInfo.FairsCountryList,true));
            }
        }
	
        private string _imgPath;

        public string ImgPath
        {
            get 
            {
                if (!string.IsNullOrEmpty(_imgPath))
                {
                    if (!_imgPath.Contains(Globals.Settings.UploadInfo.RootAttachFolder))
                    {
                        _imgPath = Globals.Settings.UploadInfo.RootAttachFolder +
                            _imgPath;
                    }
                }
                else
                {
                    _imgPath = Globals.Settings.UploadInfo.ImgEmptyPathSmall;
                }
                
                return  ResolveClientUrl(_imgPath); 
            }
            set { _imgPath = value; }
        }
    }
}

